
A = load '$inputDir/event_trace.tab' as (a, b, c, d, e, f, g, h, end_reason: int); 
B = filter A by end_reason is not null; 
C = group B by end_reason;
D = foreach C generate group, COUNT($1);
E = order D by $1; 
STORE E INTO '$outputDir' USING PigStorage(); 
